/*
 * @Author: 飞越疯人院 353362604@qq.com
 * @Date: 2022-10-13 08:30:36
 * @LastEditors: 飞越疯人院 353362604@qq.com
 * @LastEditTime: 2023-01-09 16:44:18
 * @FilePath: \adminstration\src\Common\Modal\TwoModalList\Organization.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

import { API_LIST } from '../../Api/Api'
import { commonTableList, BuiltInData } from '../config'
import { TwoAddBtn, ThrDeleteBtn } from '../options'

export const ProjectSetUp = async ({ upDataEvent, data, Permission }) => {
    let dataList = {
        type: '公司菜单设置',
        hideInSearch: true,
        pageSize: 10,
        params: {},
        classification: 'TableModal',
        get: API_LIST([data.uuid])['getProjectMenu'],
        additional: { key: 'OrganizationUuid', value: 'organizationUuid' },
        options: [
            Permission.findIndex(v => v.uuid === '0d944810-a7e9-412f-a9cb-f2bc11a6a7b6') !== -1 && (
                <TwoAddBtn
                    upDataEvent={upDataEvent}
                    title="添加菜单"
                    ThrKey="ThrModal"
                    value="ProjectSetUp"
                    data={data}
                />
            ),
        ],
        columns: [
            { ...commonTableList.tableName, title: '菜单名称' },
            {
                dataIndex: 'url',
                title: '菜单路径',
                valueType: 'select',
                valueEnum: BuiltInData.ProjectMenuList,
                rules: true,
                width: 150,
            },
            { ...commonTableList.sortId },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === '198184c7-d613-460a-b349-c3fd04db4e19') !== -1 && (
                            <ThrDeleteBtn
                                key="delete"
                                record={record.uuid}
                                upDataEvent={upDataEvent}
                                data={{ key: 'delete', url: 'delProjectMenu', title: '删除菜单' }}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return dataList
}
